import os
from pprint import pprint

import pandas as pd

class DateOperation:
    def __init__(self,path):
        #从pandas读取文件
        self.data=pd.read_csv(path)    #csv ,tsv ,txt

    def get_data_to_dict(self):
        #[{},{},{}]
        return [self.data.loc[i] for i in self.data.index.values]

    def get_data_to_list(self):
        #[[],[],[]]
        return self.data.values.tolist()

if __name__ == '__main__':
    # #设置数据文件路径
    # project_path=os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    # path=os.path.join(project_path,'data/lj_data.csv')  #join用来路径连接
    #
    base_path=os.path.dirname(os.path.dirname(__file__)) +'\\data'
    # filepath=os.path.join(base_path,filename)
    print(base_path)

    #创建对象
    # data=DateOperation(path)
    # pprint(data.get_data_to_list())